package ecs

import (
	"fmt"
	"myproject/internal/container"
	"myproject/internal/service"

	"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
)

type Service struct {
	service.BaseService
}

func NewService(container *container.Container) *Service {
	return &Service{
		BaseService: service.NewBaseService(container),
	}
}

func (s *Service) DoSomething() ([]ecs.Instance, error) {
	client := s.Container.GetECSClient()
	request := ecs.CreateDescribeInstancesRequest()
	request.Scheme = "https"
	response, err := client.DescribeInstances(request)
	if err != nil {
		return nil, fmt.Errorf("failed to create ECS cient: %v", err)
	}
	return response.Instances.Instance, nil
}
